const Service = require('egg').Service;
const uuidv1 = require('uuid').v1;
// const sequelize = require('sequelize');
class UserService extends Service {
    async queryList(uid) {
      const user = await this.ctx.body;
      console.log(uid)
      // const users = await this.ctx.model.query('select * from base_module where username = ?', uid.username);
      return user;
    }
    async queryAllList() {
      let result = null;
      try {
        result = await this.ctx.model.List.findAll();
      } catch (err) {
        this.logger.error(err.message);
      }
      return result;
    }
    async addItem(params) {
      let result = null;
      try {
        params.id = uuidv1();
        result = await this.ctx.model.List.create(params);
        console.log(result)
      } catch (err) {
        this.logger.error(err.message);
      }
      return result;
    }
    // async queryAllList() {
    //   return this.ctx.model.List;
    // }
    getModel() {
      return this.ctx.model.List;
    }
  }
  
  module.exports = UserService;